<?php

class StaffView {
	public static $staffRoles = array('Jobbare', 'Kock', 'Prospect', 'Bargeneral');

	public function getStaffApplicationsMarkup(/* array() EventStaff*/ $eventStaffs) {
		$length = count($eventStaffs);
		$previousEventId = null;
		
		$staffApplicationTable = '<div id="staff_applications">
			<table>';
		
		for ($i = 0; $i < $length; ++$i) {
			$es = $eventStaffs[$i];

			if ($previousEventId != $es->visitorEventId) {
				$staffApplicationTable .= '<tr class="event-title"><td class="role" colspan="4"><h3>' . $es->visitorEventStart . '</h3></td></tr>';
				$previousEventId = $es->visitorEventId;

			}
			
			$staffApplicationTable .= ($i % 2 === 0) ? '<tr class="odd"><td class="username">' : '<tr class="even"><td class="username">';
			$staffApplicationTable .= '<a href="http://www.facebook.com/' . $es->username . '"><img src="https://graph.facebook.com/' . $es->username . '/picture" /></a>';
			$staffApplicationTable .= '</td><td class="fullname">';
			$staffApplicationTable .= '<a href="http://www.facebook.com/' . $es->username . '">Facebooklänk</a>';
			$staffApplicationTable .= '</td><td class="edit">';
			$staffApplicationTable .= '<form  method="post" class="administer-applications">
					<input type="submit" name="confirm" value="Godkänn!" />
					<input type="submit" name="delete" value="Ta bort!" />
				</form>';
			$staffApplicationTable .= '</td></tr>';
		}
		$staffApplicationTable .= '</table></div>';
		
		return $staffApplicationTable;

	}
}